﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using GameCore;
using HandlingInput;

namespace GameObject
{
    public abstract class Window : VisibleGameObject
    {
        public int s_normal = 0;
        public int s_hover = 1;
        public int s_click = 2;

        private object tag;

        private bool enable = true;

        public bool Enable
        {
            get { return enable; }
            set { enable = value; }
        }

        public object Tag
        {
            get { return tag; }
            set { tag = value; }
        }

        public delegate void GetEvent(Window window, GameState gs);
        public virtual event GetEvent Enter;
        public virtual event GetEvent Hover;
        public virtual event GetEvent Normal;

        private string _textDisplay;

        public string TextDisplay
        {
            get { return _textDisplay; }
            set { _textDisplay = value; }
        }

        private SpriteFont _font;

        public SpriteFont Font
        {
            get { return _font; }
            set { _font = value; }
        }
        /// <summary>
        /// Hàm khởi tạo Window
        /// </summary>
        /// <param name="_numberSprite">số lượng Sprite</param>
        /// <param name="strResource">Danh sách ảnh trên mỗi sprite</param>
        /// <param name="textDisplay">Text sẽ được hiển thị</param>
        /// <param name="font">Font của text</param>
        /// <returns></returns>
        public virtual bool Init(int _numberSprite, string[] strResource, string textDisplay, SpriteFont font)
        {

            _textDisplay = textDisplay;
            Font = font;
            _nsprite = _numberSprite;
            _sprite = new Sprite[_nsprite];
            _lsprite = new List<Vector2>();


            for (int i = 0; i < _nsprite; i++)
            {
                Texture2D[] texture = new Texture2D[strResource.Length];
                for (int j = 0; j < strResource.Length; j++)
                {
                    texture[j] = GlobalDefine.Content.Load<Texture2D>(@"Pictures/" + strResource[j]);
                }
                _sprite[i] = new Sprite(0, 0, 0, 0, texture);
            }

            return true;
        }


    }
}
